<?php

class TranslationsController extends Controller{

	public function accessRules(){
		return array(
				array('allow',
						'actions'=>array( 'loadDomain' ),
						'users'=>array('*'),
				)
		);
	}
	
	public function filters(){
		return [ 'accessControl' ];
	}
	
	public function actionLoadByDomain( $domain, $language = null ){
		$lng = $language ? $language : Yii::app()->language;
		$translations = Yii::app()->messages->loadMessages( $domain, $lng );
		$this->renderJSON( $translations );
	}

}